﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 对整数数组排序的方法
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] array = { 2, 1, 4, 5, 0 };
            Sort(array);
        }
        private static void Sort(int[] array)
        {
            //排序
            for (int i = 0; i < array.Length - 1; i++)
            {
                for (int j = 0; j < array.Length - 1 - i; j++)
                {
                    if (array[j] > array[j + 1])
                    {
                        int temp = array[j];
                        array[j] = array[j + 1];
                        array[j + 1] = temp;
                    }
                }
            }
            foreach (var item in array)
            {
                Console.WriteLine(item);
            }
        }
    }
}
